package init

import (
	"api_gateway/basic/config"
	user "api_gateway/basic/proto/user"
	"flag"
	"log"

	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
)

// 初始化用户服务的gRPC客户端
func InUserGrpc() {
	flag.Parse()
	conn, err := grpc.NewClient("127.0.0.1:50051", grpc.WithTransportCredentials(insecure.NewCredentials()))
	if err != nil {
		log.Fatalf("did not connect: %v", err)
	}

	config.UserClient = user.NewUserClient(conn)

}
